home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Java Primer Plus
/
Java Primer Plus (Waite Group Proess)(1996).iso
/
chapter10
/
threed.java
< prev
next >
Wrap
Text File
|
1995-12-31
|
589b
|
29 lines
/* Allocating often used (and comparatively hard to */
/* calculate) values in static variables */
class threed {
static float sines[] = new float[360];
static float cosines[] = new float[360];
static {
double gd;
for (int g=0;g<360;++g) {
gd = (double)g * 0.01745;
sines[g] = (float)Math.sin(gd);
cosines[g] = (float)Math.cos(gd);
}
}
}
class threedtest {
public static void main (String arg[]) {
// threed t = new threed();
System.out.println(threed.cosines[0]);
// System.out.println(t.cosines[0]);
}
}